import 'package:domeone/luyou/xiangqingpage.dart';
import 'package:flutter/material.dart';

class HomePage extends StatelessWidget {
  const HomePage({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text('首页'),
      ),
      body: Center(
        child: Column(
          children: [
            const Text('HomePage'),
            ElevatedButton(
              onPressed: () {
                // 跳转详情页 - 写法 1
                Navigator.push(context, MaterialPageRoute(builder: (context) {
                  return const DetailPage();
                }));
              },
              child: const Text('跳转详情页-写法 1'),
            ),
            ElevatedButton(
              onPressed: () {
                // 跳转详情页 - 写法 2
                Navigator.pushNamed(context, '/detail', arguments: '详情页');
              },
              child: const Text('跳转详情页-写法 1'),
            ),
          ],
        ),
      ),
    );
  }
}
